//----BEGIN LICENSE----//
/*****************************************************************\
** prevalentLite - sqlite3 persistence object library 
**
** Copyright (C) 2008 Philip R. Schuchardt
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program.  If not, see <http://www.gnu.org/licenses/>.
**
*****************************************************************/
//----END LICENSE----//

/*-------------------------------------------------------------------------------------------------
        plQString is a database aware QString.  It caches a double
	in memory.  When the double is assigned updates the database
	automatically.
	
	By: Philip Schuchardt - 2008-10-26
---------------------------------------------------------------------------------------------------*/

#ifndef plQSTRING_H
#define plQSTRING_H

//STD includes
#include <QString>

//Our includes
#include "plData.h"

class plQString : public plData {

	public:
	//Constructor
        plQString();
	
	//Constructor
        plQString(const char* value);
	
	//Constructor
        plQString(const QString& value);
	
	//Copy constructor
        plQString(const plQString& obj);
	
        virtual ~plQString() { }

	//Accessor
        const QString& Data() const;
	
	//Modifier
	void SetData(const QString& value);
	
	//Operator overloading
	void operator=(const QString& value);
	
	//Operator overloading
        void operator=(const plQString& obj);
	
	//Operator overloading
	void operator=(const char* value);
	
	//Operator casting overloading
        operator const QString&() const;
        operator QString() const;
	
	//Binds the data with the statement
	virtual void Bind(sqlite3_stmt* statement, int index = 1) const;
	
	//Gets the data from the current statement
	virtual void Column(sqlite3_stmt* statement, int index = 0);
	
	//The classes name
        static const char* GetClassName() { return "plQString"; }
	
	
private:

        void Copy(const plQString& obj);

        QString Value;
};



#endif //plQSTRING_H

